#include<cstdio>
#include<cstring>
const int maxn=1011;
int n,m,d;
int a[maxn];
bool flag;
bool vi[maxn],prim[10001];
bool isPrim(int n)
{
	return prim[n];
}
int max(int x,int y)
{
	return x>y?x:y;
}
bool judge(int k)
{
	int s=a[k];
	bool f=true;
	for(int i=k-1;i>=max(k-d+1,1);i--)
	{
		s+=a[i];
		if(isPrim(s)){f=false;break;}
	}
	return f;
}	
void print()
{
	for(int i=1;i<m-n+1;i++)
		printf("%d,",a[i]);
	printf("%d\n",a[m-n+1]);
}
void dfs(int k)
{
	if(k>m-n+1){flag=true;print();}
	else
		for(int i=n;i<=m;i++)
		{
			if(flag)return;
			if(vi[i])continue;
			a[k]=i;
			if(k>=2&&!judge(k))continue;
			vi[i]=true;
			dfs(k+1);
			vi[i]=false;			
		}			
}
int main()
{
	memset(prim, 1, sizeof (prim));  
    prim[0] = prim[1] = 0;  
    for (int i = 2; i < 10000; i++)  
        if (prim[i])  
            for (int j = i * i; j < 10000; j += i)  
                prim[j] = 0;  
	while(scanf("%d%d%d",&n,&m,&d),n!=0)
	{
		memset(vi,0,sizeof(vi));
		memset(a,0,sizeof(a));
		flag=false;
		dfs(1);
		if(!flag)printf("No anti-prime sequence exists.\n");
	}
	return 0;
}

